﻿using System;
using System.Collections.Generic;
using System.Data;

namespace 发邮件
{
    class Program
    {
        static void Main(string[] args)
        {
            DataTable dataTable = ExcelUtility.ExcelToDataTable(@"C:\Users\11572\Desktop\SeedEmail.xls", 0, true);

            List<Email> emailList = new List<Email>();

            foreach (DataRow item in dataTable.Rows)
            {
                emailList.Add(new Email()
                {
                    strHost = "smtp.163.com",
                    strAccount = "sun645430",
                    to = item["Eamil地址"].ToString(),
                    title = "测试发邮件",
                    strPwd = "sun645430",
                    strFrom = "sun645430@163.com",
                    content = item["姓名"] + ":111111",
                });
            }
            foreach (var item in emailList)
            {
                item.sendMail(item);
            }

        }
    }
}
